﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace ShapeDemo.UC
{
    /// <summary>
    /// Interaction logic for ucTooltip.xaml
    /// </summary>
    public partial class ucTooltip : UserControl
    {
        public ucTooltip()
        {
            InitializeComponent();
            this.Visibility = Visibility.Hidden;
        }

        public string Title 
        {
            set 
            { 
                tbTitle.Text = value;
            } 
        }
        public string Description
        {
            set
            {
                tbDescription.Text = value;
            }
        }

        private string _bgColor;
        public string BgColor
        {
            get
            { 
                return _bgColor;
            }
            set
            {
                _bgColor = value;
                path.Fill = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value));
                gridTooltip.Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value));
            }
        }


        public void Show(Point center)
        {
            //Crear en el expressions el tooltip y aparecerlo o desaparecerlo
            Canvas.SetLeft(this, center.X - (this.ActualWidth / 2));
            Canvas.SetTop(this, center.Y + 4);
            Canvas.SetZIndex(this, 999);
            this.Visibility = Visibility.Visible;
        }

        public void Hide()
        {
            this.Visibility = Visibility.Hidden;
        }
    }
}
